{extend name="base" /} {block name="body"}
<div class="layui-body">
	<!--tab标签-->
	<div class="layui-tab layui-tab-brief">
		<ul class="layui-tab-title">
			<li class="">
				<a href="{:url('admin/area/index')}">场地管理</a>
			</li>
			<li class="layui-this">添加场地</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<form class="layui-form form-container" action="{:url('admin/area/add')}" method="post">
					<div class="layui-form-item">
						<label class="layui-form-label">所属分类</label>
						<div class="layui-input-block">
							<select name="cate_id" lay-verify="required">
								{foreach name="category_level_list" item="vo"}
								<option value="{$vo.id}">{neq name="vo.level" value="1"}| {php}for($i=1;$i
									<$vo[ 'level'];$i++){echo ' ----';}{/php}{/neq} {$vo.name}</option>
										{/foreach}
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">标题</label>
						<div class="layui-input-block">
							<input type="text" name="title" required lay-verify="required" placeholder="请输入标题" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">费用</label>
						<div class="layui-input-block">
							<input type="text" name="money" placeholder="请输入费用" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">本月档期</label>
						<div class="layui-input-block">
							<table id="calendar" class="calendar">
								<tr>
									<td>1<input name="dangqi[1]" type="checkbox" /></td>
									<td>2<input name="dangqi[2]" type="checkbox" /></td>
									<td>3<input name="dangqi[3]" type="checkbox" /></td>
									<td>4<input name="dangqi[4]" type="checkbox" /></td>
									<td>5<input name="dangqi[5]" type="checkbox" /></td>
									<td>6<input name="dangqi[6]" type="checkbox" /></td>
									<td>7<input name="dangqi[7]" type="checkbox" /></td>
								</tr>
								<tr>
									<td>8<input name="dangqi[8]" type="checkbox" /></td>
									<td>9<input name="dangqi[9]" type="checkbox" /></td>
									<td>10<input name="dangqi[10]" type="checkbox" /></td>
									<td>11<input name="dangqi[11]" type="checkbox" /></td>
									<td>12<input name="dangqi[12]" type="checkbox" /></td>
									<td>13<input name="dangqi[13]" type="checkbox" /></td>
									<td>14<input name="dangqi[14]" type="checkbox" /></td>
								</tr>
								<tr>
									<td>15<input name="dangqi[15]" type="checkbox" /></td>
									<td>16<input name="dangqi[16]" type="checkbox" /></td>
									<td>17<input name="dangqi[17]" type="checkbox" /></td>
									<td>18<input name="dangqi[18]" type="checkbox" /></td>
									<td>19<input name="dangqi[19]" type="checkbox" /></td>
									<td>20<input name="dangqi[20]" type="checkbox" /></td>
									<td>21<input name="dangqi[21]" type="checkbox" /></td>
								</tr>
								<tr>
									<td>22<input name="dangqi[22]" type="checkbox" /></td>
									<td>23<input name="dangqi[23]" type="checkbox" /></td>
									<td>24<input name="dangqi[24]" type="checkbox" /></td>
									<td>25<input name="dangqi[25]" type="checkbox" /></td>
									<td>26<input name="dangqi[26]" type="checkbox" /></td>
									<td>27<input name="dangqi[27]" type="checkbox" /></td>
									<td>28<input name="dangqi[28]" type="checkbox" /></td>
								</tr>
								<tr>
									<td>29<input name="dangqi[29]" type="checkbox" /></td>
									<td>30<input name="dangqi[30]" type="checkbox" /></td>
									<td>31<input name="dangqi[31]" type="checkbox" /></td>
								</tr>
							</table>
							(红色为占用日期)
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">场地封面</label>
						<div class="layui-input-block" id="upload-div">
							<img src="" class="img-see" />
							<input type="text" name="thumb" readonly class="layui-input layui-input-inline">
							<input type="file" name="file" class="layui-upload-file">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">场地图集</label>
						<div class="layui-input-block">
							<button type="button" id="upload-photo-btn" class="layui-btn">上传图集</button>
							<div id="photo-container">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">详细内容</label>
						<div class="layui-input-block">
							<textarea id="content" name="content" class="layui-textarea" lay-verify="content"></textarea>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">状态</label>
						<div class="layui-input-block">
							<input type="radio" name="status" value="1" title="显示" checked="checked">
							<input type="radio" name="status" value="0" title="隐藏">
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit lay-filter="*">保存</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block} {block name="js"}
<script src="__JS__/kindeditor/kindeditor.config.js"></script>
<script src="__JS__/kindeditor/kindeditor-all-min.js"></script>
{/block} {block name="script"}
<script>
	$(document).ready(function() {
		var _kindEditor;
		KindEditor.ready(function(K) {
			_kindEditor = K.create('#content', KindEditorOptions);
			K('#upload-photo-btn').click(function() {
				var photo_list_item = '';
				_kindEditor.loadPlugin('multiimage', function() {
					_kindEditor.plugin.multiImageDialog({
						showRemote: false,
						imageUrl: K('#photo').val(),
						clickFn: function(data) {
							$.each(data, function(index, item) {
								photo_list_item += '<div class="photo-list"><img src="' + item.url +
									'" class="photo-see" /><input type="text" name="photo[' + item.url + ']" style="display:none;">';
								photo_list_item += '<button class="layui-btn layui-btn-danger remove-photo-btn">移除</button></div>';
							});
							$('#photo-container').append(photo_list_item);
							_kindEditor.hideDialog();
						}
					});
				});
			});
		});

		$('#photo-container').on('click', '.remove-photo-btn', function() {
			$(this).parent('.photo-list').remove();
		});
	});
</script>
{/block}